package cn.digitalgd.directoryTree.controller;

import cn.digitalgd.directoryTree.pojo.vo.DirectoryVO;
import cn.digitalgd.directoryTree.pojo.vo.PageVO;
import cn.digitalgd.directoryTree.service.IDirectoryService;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ Author：浅汐
 * @ Date：2024/7/16
 * @ Desc：
 */

@RestController
public class DirectoryController {
    @Resource
    private IDirectoryService directoryService;
    @PostMapping("/creat")
    public void createANewNode(@RequestBody DirectoryVO directoryVO){
        directoryService.createANewNode(directoryVO);
    }
    @PutMapping("/update")
    public void updateANode(@RequestBody DirectoryVO directoryVO){
        directoryService.updateANode(directoryVO);
    }
    @PutMapping("/up/{id}")
    public void upANode(@Param("id")Long id){
        directoryService.upANode(id);
    }
    @PutMapping("/down/{id}")
    public void downANode(@Param("id")Long id){
        directoryService.downANode(id);
    }
    @GetMapping("/page")
    public void pageTree(@RequestBody PageVO pageVO){
        directoryService.pageTree(pageVO);
    }
}
